﻿using Core.ApplicationServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.DomainServices
{
    public abstract class IArticleCrawlable
    {
        public int ItemIndex;

        public abstract bool Parser(string category, IList<string> results);

        public abstract string BuildUrl(string category);
        public abstract string RootUrl { get; }

        public virtual Uri GetUrl(string url)
        {
            return new Uri(url);   
        }

        public virtual string GetHost(string url)
        {
            return GetUrl(url).Host;
        }

        public virtual string GetConfigKeyByUrlAndCategory(string url, string category)
        {
            return string.Format("{0}.{1}", GetUrl(url).Host, category);
        }
    }
}
